#!/usr/bin/env python
from socket import getservbyport
from socket import getservbyname
import sys

def output(s):
    try:
        print getservbyport(int(s))
    except Exception:
        print getservbyname(s.lower())

if __name__ == '__main__':
    output(sys.argv[1])

